package com.learnyou.server.xingzuo.controller.web;

import com.learnyou.server.xingzuo.common.exception.ApiResult;
import com.learnyou.server.xingzuo.dto.paramDTO.pet.DeviceBaseInfoDTO;
import com.learnyou.server.xingzuo.dto.paramDTO.pet.DevicePingParamDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/device")
@Api(tags = "DeviceResource")
public interface DeviceResource {

    @ApiOperation(value = "提交设备心跳数据")
    @PostMapping("/ping")
    ApiResult ping(@Validated @RequestBody DevicePingParamDTO devicePingParamDTO);


    @ApiOperation(value = "注册账户")
    @PostMapping
    ApiResult registerAccount(String deviceNo, String phone);

    @ApiOperation(value = "主账户解绑子账号")
    @DeleteMapping
    ApiResult unbindAccount(String deviceNo, String phone);

    @ApiOperation(value = "用手机号查询设备列表")
    @GetMapping("/list")
    List<String> getDevicesByAccount(String phone);

    @ApiOperation(value = "基本信息查询")
    @GetMapping
    DeviceBaseInfoDTO getBaseInfo(String deviceNo);

    @ApiOperation(value = "基本信息更新")
    @PutMapping
    ApiResult updateBaseInfo(@Validated @RequestBody DeviceBaseInfoDTO deviceBaseInfoDTO, Integer id);
}
